﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Twi.COMMON.HTTP;

namespace Twi.COMMON.WPF
{
    public class SysDateTime
    {
        #region 获得系统当前最新时间
        /// <summary>
        /// 获得系统当前最新时间
        /// </summary>
        /// <returns></returns>
        public static DateTime GetNowDateTime()
        {
            string tempDateTime = ""; //临时
            using (var res = "ServerCommon/GetDateTime".HttpGet())
            {
                ProcessRequest.Process(res, (ResponseMessageInfo resInfo) =>
                {
                    tempDateTime = DateTime.Parse(resInfo.ResponseDataMainBody.Value).ToString("yyyy-MM-dd HH:mm:ss");
                });
            }
            return dateTime = DateTime.Parse(tempDateTime);
        }
        #endregion

        #region 系统当前时间
        /// <summary>
        /// 系统当前时间
        /// </summary>
        public static DateTime dateTime
        {
            get;
            set;
        }
        #endregion 
    }
}
